package com.lagou.mr.homework;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

/*
* reduce方法的代码
* */
public class NumReducer extends Reducer<NumBean, NullWritable, IntWritable,IntWritable> {
    int id = 1;
    @Override
    protected void reduce(NumBean key, Iterable<NullWritable> values, Context context) throws IOException, InterruptedException {
        for (NullWritable value : values) {
            context.write(new IntWritable(id),new IntWritable(key.getNum()));
            id++;
        }
    }
}
